package com.delu.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118651898";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDnsYjOdVhx2ahEnXnWnpaKr0OyNUAqMUryOFpS+2A+2iD9lJWNN02Kybz5UcTjRfb8y0U5qdcpsHUiplgJHeCp797ur6j3CbAx2n2yGE3VO151SN5W5dqZNV+aXm2A7dPYbNyLLvwT9fQGoJmTwJvkTt+de/hNOB4fmvMyQOWx27Ej2MkLdXXjTQugE8cLkiqnXQQj34NN9I6A3lcTS2pn77c21gdRIUUaHfiLRf6IRcqYH9pH1bDxD2LtIs3NCE9hJkd9ksyHDlUM/UNuD9ZSCjZC3HWeKWoKlI/YYFBQKSaZP08sDA9QSb2OMMh1seT+VRbi9J8ylI2B4/jR3j9tAgMBAAECggEAZpzBCzb7Scjs9h6MVFn+MEO5BpcA6O7V03rTvgaotI1kqQoCRf2lMP9x2zW0rjdRUNoxuX0X1tXYutTTDo6V7o1WvX08ptQ6nYm3u4V6CyL1DZqNJg08iDgUNEj31G8AMMzdzCKt76UxQzIjckWOhUnNTXEXIhPle3fjl3EYiXD8EamKet4KXwsg5gQ3Olm4RrmQwUCVXFHSIuwjHUnVxT+jkrEoF9keMJUlv88/kgnIb31y49K4ErR69lmgno1oRhjEq4uqFRj9oxRy2PnF5nRvTYW7URA+cWRJ4P87ilYvFHepRjDBfZv/ku2cKzojDKmb5Ine1SIlj3EAAqdUoQKBgQD+OPcCfANPBYT+79Ql4w0SpULn2euRacHMo0H0fMCWQSUm3WMwAWoX0noO8VGpQ4M1JW0wT5NcASXfA1y5/N94sIrtznpK6KynJkmz4vSkOVZEgzJBkRz2DMSIOXUml0c0x0i6mD80fP9ivXvvBAU5qXZPUyJfkmuisI1eLFMIaQKBgQDpUD6fUQ69XGfQs9ZX3jiH4sHV/ITwo8sMQ7Vl9BrpU9uWh4AHYVhGBcUJlUDemh3klBmmysuo6tO01tB8OPVU2vOCE6P9IsTTur3qgAgcP1TbtTsC31+zUDYVWdksnnOYGPmkqFCy3hu2izHNHXnqqSgxMosRaKxqxdmIYi6+ZQKBgQDl4p9DKN9ZEtWsLzU5OXM13Cl/PSlu6iJsqWjX7AO/G5O77FBoNa85cYQchQ3iMQGyCnENUbggZ41WeFTefpOaMJLA7ojZukN+NvpI579vzcV72OOWNOHqgasqwEJ2ri+ew2K6ETh+f1X1dQFgJtOOy/YHT1by85XPnTWI5i4DmQKBgQCz5EZUiqglwzDcjzzuRQ4rX+B6wJgz/uaZDz+3W47AZwMBvnottpXcb6hr6iO5PvVbgAGDRAvhsyYG4jagAT7P7X4hxkkD7aH7apnyTEN0nDQurz7PyTE9zdPVhJBZwdZ46JDbr1eBgpW1mv+MGnUdRM4TmNf3VVDThrdiW+mUrQKBgFGSIGXlaquQcx0h9zukKsVp3vkR0pmbULdrCurEpGKdZ3kPkEWqGPGqVivZct+TfneR5VqxuT71+MCCoqGoEJdPKVXmmT8PzH0ZZvXGT6agCqO3vFyqMnkzk5CBuGDqwniliN4398kyfW3UuvLjb1rd6gBXlB2A3CiOTUyL8rMl";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjT+ZqoW+xFGKyumgXe4Qkdkq2GoT4C7CrHoV/XbewtIkzvQ6MKV2800iOMF6KLn+O4csumNIX2ZR5XGQqqn6gpagoXkMqO9XM1Xo1X7dMGklklpxf8dgBOaqyTPh98WTw9vuy+NtEHKAu7rZF2SP+wRYLnzGmhFuDnnYSYI4wuWw1CQW5kPeMoxygWRJRh1CAf5sRFuoZR4heipM15TwLbeXTHfFx+ms8zWQggMelvex2k8RB/bzxNQXhSclmMsMmOyvF8Q1tDfOL3WUwWU5MgoyNc+HCVFllQQ07kRgPP+XzGsSjmrj1KGEqe8Y4x+XUnBBL31B3Ioa2cggX19dYQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://45658394mt.qicp.vip/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://45658394mt.qicp.vip/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
